//
//  ViewController.m
//  YYBannerProject
//
//  Created by 蓓蕾 on 2021/8/26.
//

#import "ViewController.h"
#import "BannerView.h"

#import <SDCycleScrollView.h>

#import "ASRotationPageView.h"
#import "ASPageView.h"

@interface ViewController ()<SDCycleScrollViewDelegate>

@property (nonatomic, strong) ASPageView *pageView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
//    BannerView *bannerView = [[BannerView alloc] initWithFrame:CGRectMake(10, 20, S_WIDTH - 20, 300)];
//    bannerView.directionType = VerticalDirectionType;
//    bannerView.locationType = RightCenterType;
////    bannerView.shapeType = SquareType;
//    bannerView.shapeType = RectangleType;
//    bannerView.localImageArr = @[@"880_1",@"880_2",@"880_3",@"1",@"2",@"3"];
//    [self.view addSubview:bannerView];
    
    
//    ASRotationPageView *pageView = [[ASRotationPageView alloc] initWithFrame:CGRectMake(10, 350, S_WIDTH - 20, 200) images:@[@"880_1",@"880_2",@"880_3",@"1",@"2",@"3"]];
//    [self.view addSubview:pageView];
//    [pageView showStart];
    
    SDCycleScrollView *cycleSV = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(10, 350, S_WIDTH - 20, 200) delegate:self placeholderImage:nil];
    [self.view addSubview:cycleSV];
    cycleSV.scrollDirection = UICollectionViewScrollDirectionVertical;
    cycleSV.localizationImageNamesGroup = @[@"880",@"880_2",@"880_3",@"1",@"2",@"3"];
    cycleSV.showPageControl = NO;
    
    _pageView = [[ASPageView alloc] initWithFrame:CGRectMake(CGRectGetWidth(cycleSV.frame) - 20, 0, 20, CGRectGetHeight(cycleSV.bounds)) pageNumber:6];
//    _pageView = [[ASPageView alloc] initWithFrame:CGRectMake(CGRectGetWidth(cycleSV.frame) - 20, 0, CGRectGetHeight(cycleSV.bounds), 20) pageNumber:6];
    [cycleSV addSubview:_pageView];
    _pageView.pageIndicatorTintColor = [UIColor orangeColor];
    _pageView.currentPageIndicatorTintColor = [UIColor purpleColor];
    _pageView.pageSize = CGSizeMake(3, 20);
//    _pageView.pageSize = CGSizeMake(20, 20);
//    _pageView.pageSize = CGSizeMake(20, 3);
    _pageView.pageDirection = ASpageViewDirectionVertical;
//    _pageView.circularPage = NO;
    _pageView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.05];
//    _pageView.userInteractionEnabled = YES;
    _pageView.ClickASPageView = ^(NSUInteger currentPage) {
        NSLog(@"currentPage = %ld",currentPage);
        [cycleSV makeScrollViewScrollToIndex:currentPage];
    };
    
//    ASRotationPageView *pageView = [[ASRotationPageView alloc] initWithFrame:self.view.bounds images:@[@"880_1",@"880_2",@"880_3",@"1",@"2",@"3"]];
//        pageView.scrollDirection = ASRotationScrollDirectionHorizontal;
//        pageView.infiniteSliding = NO;
//        pageView.autoSliding = YES;
//        pageView.ScrollDidEnd = ^(NSUInteger currentPage) {
////            weakself.pageView.currentPage = currentPage;
//        };
//    pageView.SelectView = ^(NSInteger index) {
//
//    };
//        [pageView showStart];
//        [self.view addSubview:pageView];
    
    
    
}

- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index
{
    _pageView.currentPage = index;
}


@end
